﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package org.aswing.plaf.basic.background {
    import flash.display.*;
    import org.aswing.*;
    import flash.filters.*;
    import org.aswing.geom.*;
    import org.aswing.plaf.*;
    import org.aswing.graphics.*;
    import org.aswing.plaf.basic.*;

    public class FrameBackground implements GroundDecorator, UIResource {

        protected var shape:Sprite;
        protected var bar:Shape;

        public function FrameBackground(){
            this.shape = new Sprite();
            this.bar = new Shape();
            this.shape.mouseChildren = false;
            this.shape.mouseEnabled = false;
            this.shape.addChild(this.bar);
        }
        public function getDisplay(_arg1:Component):DisplayObject{
            return (this.shape);
        }
        public function updateDecorator(_arg1:Component, _arg2:Graphics2D, _arg3:IntRectangle):void{
            var _local4:Number;
            var _local5:Number;
            var _local6:ASColor;
            var _local7:StyleResult;
            var _local8:StyleTune;
            var _local9:Number;
            var _local10:int;
            var _local11:FrameUI;
            var _local12:Number;
            var _local13:Array;
            this.shape.graphics.clear();
            this.bar.graphics.clear();
            if (_arg1.isOpaque()){
                _local4 = 6;
                _local5 = 6;
                _local6 = _arg1.getMideground();
                _local8 = _arg1.getStyleTune().mide;
                _local9 = 1;
                _arg3 = new IntRectangle(1, 2, ((_arg1.width - _local4) - 1), ((_arg1.height - _local5) - 2));
                _arg2 = new Graphics2D(this.bar.graphics);
                _local10 = 24;
                if ((_arg1 is JFrame)){
                    _local10 = (_arg1 as JFrame).getTitleBar().getSelf().getHeight();
                };
                _local7 = new StyleResult(_local6, _local8);
                BasicGraphicsUtils.fillGradientRoundRectBottomRightAngle(_arg2, new IntRectangle(_arg3.x, _arg3.y, _arg3.width, Math.min((_local10 - 2), _arg3.height)), _local7, (Math.PI / 2));
                this.bar.filters = [new BevelFilter(1, 90, 0xFFFFFF, _local8.shadowAlpha, 0, 0.1, 1, 1, 1, 1, BitmapFilterType.INNER), new BevelFilter(1, 90, 0, 0.1, 0xFFFFFF, _local8.shadowAlpha, 1, 1, 1, 1, BitmapFilterType.OUTER)];
                _arg2 = new Graphics2D(this.shape.graphics);
                _local11 = (_arg1.getUI() as FrameUI);
                if (_local11){
                    if (!_local11.isPaintActivedFrame()){
                        _local9 = 0.5;
                    };
                };
                _local6 = _arg1.getBackground();
                _local8 = _arg1.getStyleTune();
                _local7 = new StyleResult(_local6, _local8);
                _local12 = Math.min(1, ((_local10 * 2.2) / _arg3.height));
                _local13 = [(0xFF * (1 - _local12)), 0xFF];
                BasicGraphicsUtils.fillGradientRoundRect(_arg2, _arg3, _local7, (-(Math.PI) / 2), false, null, _local13);
                this.shape.filters = [new DropShadowFilter(2, 45, 0, (_local7.shadow * _local9), _local4, _local5, 1, 1)];
            };
            this.shape.visible = _arg1.isOpaque();
        }

    }
}//package org.aswing.plaf.basic.background 
